//=============================================================================
/**
 * @file	poke_select.h
 * @brief	ポケモン選択アプリ
 * @date	2007.07.10
 */
//=============================================================================

#ifndef	__POKE_SELECT_H__
#define	__POKE_SELECT_H__

#include "common.h"
#include "poketool/pokeparty.h"
#include "application/pokemon_select/poke_sel_cmn_def.h"

typedef struct BOX_POKE_DATA_tag
{
	int MonsNo;
	int PsnlRnd;
	u16 Egg;
	u16 Form;
	u16 Item;
	u16 Ball;
	u16 Rare;
	u16 Sex;
	u16 Level;
	u16 Mark;
	STRCODE NickName[MONS_NAME_SIZE+EOM_SIZE];
}BOX_POKE_DATA;

//選択アプリからの結果を格納するポケモン1体分の構造体
typedef struct SELECT_RESULT_INFO_tag
{
	int BoxIdx;
	int BoxPos;
}SELECT_RESULT_INFO;

typedef enum{
	SELECT_MAIN_RC_NONE,		//特に何もない
	SELECT_MAIN_RC_SELECT,		//ポケモンが選ばれた
	SELECT_MAIN_RC_END,		//すべての選択が終了した
	SELECT_MAIN_RC_CANCEL,	//アプリケーションがキャンセル終了
}SELECT_MAIN_RC;

typedef struct POKE_SELECT_WORK_tag * POKE_SELECT_WORK_PTR;

//コールバック関数型定義
typedef void (*POKE_SEL_CALL_BACK)(int, int, void *);
//↑引数はボックスインデックス、カーソル位置、コールバックワークポインタ

//ボックスアクセス関数
typedef BOOL (*GET_BOX_POKE_DATA)(void *AccessData, const int inBoxNum, const int inIndex, BOX_POKE_DATA *outData);
//ボックス名取得
typedef void (*GET_BOX_NAME)(STRBUF * msg, void *pBoxData, int inBoxNumber);

extern POKE_SELECT_WORK_PTR POKESEL_Alloc(const int inHeapID, const u8 inSelectPokeMax, const u8 inBoxNumMax );
extern void POKESEL_Free( POKE_SELECT_WORK_PTR ptr );

extern void POKESEL_Init(	POKE_SELECT_WORK_PTR ptr, GF_BGL_INI *inBGL,
					void *pBoxData, POKEPARTY *pMyParty,
					const BOOL inItemVisible,
					const BOOL inBallVisible,
					const BOOL inCancelOK,
					const int inFirstBox,
					GET_BOX_POKE_DATA pAccessFunc,
					GET_BOX_NAME	  pGetBoxNameFunc,
					SELECT_RESULT_INFO *outInfo,
					POKE_SEL_CALL_BACK CallBackFunc,
					void *CallBackWk );

extern void POKESEL_DefaultVBlankCallFunc(void *work);

extern SELECT_MAIN_RC POKESEL_Main(POKE_SELECT_WORK_PTR ptr);

extern void POKESEL_Draw(POKE_SELECT_WORK_PTR ptr);

extern void POKESEL_End(POKE_SELECT_WORK_PTR ptr);

extern void POKESEL_SetBoxAccessFunc(POKE_SELECT_WORK_PTR ptr, GET_BOX_POKE_DATA pAccessFunc);

#endif	//__POKE_SELECT_H__
